/**
 * Created by Wilson on 3/23/2015.
 */
(function () {
    angular.module('app')
        .controller('brandSelectorController', brandSelectorController);

    brandSelectorController.$inject = ['$scope', 'carService', 'alertController'];
    function brandSelectorController($scope, carService, alertController) {
        pageInit();

        function pageInit() {
            carService.getAllBrandList().then(function (data) {
                $scope.brands = data.datas;
            }).catch(function (data) {
                alertController.simpleAlert(data.errMsg || '通讯异常');
            });
        }

        $scope.toSeriesSelectorPage = toSeriesSelectorPage;

        function toSeriesSelectorPage(brandId) {
            tunnelService.setData('brandSelector.brandId');
            $scope.ons.navigator.pushPage('pages/car/series-selector.html');
        }

    }

})();